import argparse

from lib.visualization.ColorPrint import color_format as col_fmt


def service_run_information(service_name):
    """
    获得当前执行服务的服务信息
    :param service_name: 服务名称
    :return: 
    """
    # 准备输出对应服务的启动参数及环境变量
    print("The service [ " + col_fmt(service_name, fore='green') + " ] will be started.")
    print("Loading configuration:\n")
    pass


def usage():
    could_continue = False

    parser = argparse.ArgumentParser()
    sys_group = parser.add_mutually_exclusive_group()

    from system import version
    sys_group.add_argument("-v", "--verbose", action='version', version='%(prog)s ' + version.SERVICE_VERSION)
    parser.add_argument("-?", "--man", help="the name of service", action="store_true")
    parser.add_argument("-s", "--service", help="the name of service")
    args = parser.parse_args()

    if args.man:
        if args.service:
            print("服务类型有：\n[blog,user]")
        else:
            print("help for command detail")
    elif args.service:
        service_run_information(args.service)
        could_continue = True
    else:
        print(parser.print_help())
        could_continue = False

    return could_continue
